package com.zzyl.nursing;

import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import javax.script.ScriptEngineManager;
import javax.script.ScriptEngine;

@SpringBootTest
public class ExpressionEvaluatorTest {

    @Autowired
    private ScriptEngine engine;
    @Test
    public  void test1() throws Exception {


        String expression = "10 >= 9";
        System.out.println(expression + "表达式的结果是: " + engine.eval(expression));

        expression = "1+2+3*4";
        System.out.println(expression + "表达式的结果是: " + engine.eval(expression));
    }

}
